• Image placeholder
  • 홈 페이지
  • 블로그 센터
  • 범주
Image placeholder

data jpa

스프링 JPA 양방향 연관관계의 이해 - 영속성 전이 cascade

commentList, postImageList, postLikeList 와 같은 일대다 리스트를 보면 cascade 옵션이 달려있는 것을 확인할 수 있다. comment(댓글) 의 경우 post(게시글) 가 삭제될 경우 post와 연관된 comment 가 연쇄적으로 삭제하기 위해 cascade = CascadeType.REMOVE 을 설정하였다. postImage(게시글 이미지)의 경우 생...

JPASpring기록기억하고싶은Spring bootdata jpaJPA

스프링 JPA 양방향 연관관계의 이해 - 일대다(@OneToMany)

양방향 연관관계를 사용하면 부모 엔티티 조회 시 연관된자식 엔티티까지 조회하므로 굉장히 편하게 사용할 수 있다. 하지만 연관관계가 복잡해질수록 예상치 못한 쿼리가 나가는 것을 확인할 수 있다. PostImage(다): 하나의 Post(게시글) 작성 시 여러 사진을 올릴 수 있다. PostLike(다): 하나의 Post(게시글) 에 다수의 회원이 좋아요를 누를 수 있다. Comment(다): ...

Springdata jpaJPASpring boot기록기억하고싶은JPA

© 2022 intrepidgeeks.com

Privacy Policy Contact US Sitemap
🍪 This website uses cookies to ensure you get the best experience on our website. Learn more